<template>
  <div class="app-container">
    <wise-crud
      ref="wise-crud"
      :urls="urls"
      :fields="fields"
      :handle="handle"
      :filters="filters"
    />
  </div>
</template>
<script>

import WiseCrud from '@/components/Crud/wiseCrud'

import checkPermission from '@/pages/index/utils/permission'
export default {
  name: 'VideoManage',
  components: { WiseCrud },
  data() {
    return {
      urls: {
        list: '/api/v1/welder-sbtx-second/video-comb/listqy',
        add: '/api/v1/welder-sbtx-second/video-comb/create',
        show: '/api/v1/welder-sbtx-second/video/show/',
        update: '/api/v1/welder-sbtx-second/video-comb/update/',
        delete: '/api/v1/welder-sbtx-second/video/remove/'
      }
    }
  },
  computed: {
    spaceId() {
      return this.$store.state.project.spaceId
    },
    handle() {
     
  
          return ['add']
       
    },
    fields() {
      let arr = [{ label: '序号', type: 'index', use: ['table'] }]
      if (this.$store.state.user.project) {
        arr.push({
          prop: 'projectId',
          
          use: ['add', 'edit']
        })
      } else {
 
      }
      arr.push(
        {
          label: '视频名称',
          prop: 'name',
          type: 'text',
          labelWidth: '130px',
          rules: [
            { required: true, message: '请输入视频名称', trigger: 'change' }
          ],
          placeholder: '请输入视频名称',
          use: ['table', 'add', 'view', 'edit', 'search']
        },
        {
          label: '视频URL地址',
          prop: 'url',
          type: 'text',
          labelWidth: '130px',
          rules: [
            { required: true, message: '请输入视频URL地址', trigger: 'change' }
          ],
          placeholder: '请输入视频URL地址',
          use: [   'view',   'search']
        },
        {
          label: 'appKey',
          prop: 'appKey',
          type: 'text',
          labelWidth: '130px',
          rules: [
            { required: true, message: '请输入appKey', trigger: 'change' }
          ],
          placeholder: '请输入appKey',
          use: [   'view',  'search']
        },
        {
          label: 'appSecret',
          prop: 'appSecret',
          type: 'text',
          labelWidth: '130px',
          rules: [
            { required: true, message: '请输入appSecret', trigger: 'change' }
          ],
          placeholder: '请输入appSecret',
          use: [   'view',   'search']
        },
        
        {
          label: '所属项目',
          prop: 'projectInfo.name',
          type: 'text',
          labelWidth: '130px',
       
          use: ['table',  'view' , 'search']
        },
        //内网去除
        // {
        //   label: '通道号',
        //   prop: 'channelNo',
        //   type: 'number',
        //   labelWidth: '130px',
        //   rules: [
        //     { required: true, message: '请输入通道号', trigger: 'change' }
        //   ],
        //   placeholder: '请输入通道号',
        //   use: [ 'add', 'view', 'edit', 'search']
        // },
        {
          label: '摄像头类型',
          prop: 'typeCode',
          type: 'radio',
          dataDic: 'cameraType',
          labelWidth: '130px',
          use: [ 'table', 'view', 'search']
        },
        {
          label: '摄像头类型',
          prop: 'typeCodeObj',
          type: 'select',
          dataDic: 'cameraType',
          labelWidth: '130px',
          rules: [
            { required: true, message: '请选择摄像头类型', trigger: 'change' }
          ],
          objKeys: [
            {
              field: 'typeCode',
              key: 'value'
            }
          ],
          placeholder: '请选择摄像头类型',
          use: [  'add', 'edit']
        },
        {
          label: '视频顺序',
          prop: 'sequence',
          type: 'number',
          labelWidth: '130px',
          rules: [
            { required: true, message: '请输入视频顺序', trigger: 'change' }
          ],
          placeholder: '请输入视频顺序',
          use: ['table', 'add', 'view', 'edit', 'search']
        },{
          label: '摄像头端口号',
          prop: 'nwtd',
          type: 'number',
          labelWidth: '130px',
          rules: [
            { required: true, message: '请输入摄像头端口号', trigger: 'change' }
          ],
          placeholder: '请输入摄像头端口号',
          use: ['table', 'add', 'view', 'edit', 'search']
        },{
          label: '摄像头账号',
          prop: 'appKey',
          type: 'text',
          labelWidth: '130px',
          rules: [
            { required: true, message: '请输入摄像头账号', trigger: 'change' }
          ],
          placeholder: '请输入摄像头账号',
          use: ['table', 'add', 'view', 'edit', 'search']
        },{
          label: '摄像头密码',
          prop: 'appSecret',
          type: 'text',
          labelWidth: '130px',
          rules: [
            { required: true, message: '请输入摄像头密码', trigger: 'change' }
          ],
          placeholder: '请输入摄像头密码',
          use: ['table', 'add', 'view', 'edit', 'search']
        },{
          label: '视频内网IP地址',
          prop: 'nwurl',
          type: 'text',
          labelWidth: '130px',
          rules: [
            { required: true, message: '视频内网IP地址', trigger: 'change' }
          ],
          placeholder: '请输入视频内网IP地址',
          use: ['table', 'add', 'view', 'edit', 'search']
        },
        {
          prop: 'spaceId',
          
          use: ['add', 'edit']
        }
      )
 
 
        arr.push({
        label: '操作',
        type: 'handle',
        use: ['table'],
        handle: ['edit', 'view', 'delete'],
        tableWidth: 300
      })
     
     
      return arr
    },
    filters() {
      return [
        {
          field: 'spaceId',
          operator: 'EQUALS',
          spaceId:this.$store.state.spaceId
        }
      ]
    }
  },
  methods: {
    checkPermission,
  }
}
</script>

<style>
</style>
